<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>regist</title>

    <script>
        /*
            分析：
                点击超链接或者图片，需要换一张
                1.给超链接和图片绑定单击事件

                2.重新设置图片的src属性值

         */
        window.onload = function(){
            //1.获取图片对象
            var img = document.getElementById("check code");
            var link = document.getElementById("change")
            //2.绑定单击事件
            img.onclick = function(){
                //加时间戳
                var time = new Date().getTime();

                img.src= "./CheckCode?"+time;
            }
            link.onclick = function () {
                var time = new Date().getTime();

                img.src= "./CheckCode?"+time;
            }

        }
    </script>
</head>
<body>

<img id="check code" src="./CheckCode" >
<a id="change" href="">change</a>

</body>
</html>